package com.huiminpay.merchant.controller;

import com.yh.merchant.api.Service.IStaffService;
import com.yh.merchant.api.dto.StaffDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName : StaffController
 * @Author : 阿泽
 * @Date: 2021/8/16 17:14
 * @Description :
 */
@RestController
@Api(value = "员工管理", tags = "员工", description = "员工相关")
public class StaffController {
    @Reference
    IStaffService staffService;

    @ApiOperation("新增员工")
    @PostMapping("my/staffs/add")
    public Object addStaff(@RequestBody StaffDTO staffDTO){
        staffService.createStaff(staffDTO);
        return "操作成功";
    }
    @ApiOperation("删除员工")
    @PostMapping("my/staffs/del")
    public Object delStaff(Long id){
        staffService.delStaff(id);
        return "操作成功";
    }
    @ApiOperation("编辑员工")
    @PostMapping("my/staffs/update")
    public Object updateStaff(@RequestBody StaffDTO staffDTO){
        staffService.updateStaff(staffDTO);
        return "操作成功";
    }
}
